<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>回调函数</title>
</head>
<body>
    
</body>
<script>
    function a (fn){
        setTimeout(() => {
            let sum = 10
            fn(sum)
        },1000)
    }

    a((arr)=>{
        console.log(arr);
    })

    //简化抽离
    function b (params){
        console.log(params);
    }

    a(b)
</script>
</html>